package com.dong.pattern.chain;

import java.util.ArrayList;
import java.util.List;

public class Chain {
    private List<ChainHandler>  handlers ;
    private int index = 0;
    public void addHandler(ChainHandler handler){
        this.handlers.add(handler);
    }
    public Chain(List<ChainHandler> handlers) {
        this.handlers = handlers;
    }
    public void proceed() {
        if(index>=handlers.size()) {

        }else {
            handlers.get(index++).execute(this);
        }
    }
}
